package gmu.xytxl.util;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;




public class DBConfig {
//	private static final String PROPERTIES_NAME = "./WEB-INF/dbconfig.properties";
	public static String DB_DRIVER = null;
	public static String DB_URL = null;
	public static String DB_USER = null;
	public static String DB_PWD = null;
	static {
		Properties properties = new Properties();
		try {
			
			properties.load(DBConfig.class.getResourceAsStream("/dbconfig.properties"));
			DB_DRIVER = properties.getProperty("driver");
			DB_URL = properties.getProperty("url");
			DB_USER = properties.getProperty("username");
			DB_PWD = properties.getProperty("password");
			System.out.println("读取配置信息成功！");
			
		} catch (FileNotFoundException e) {
			System.out.println("读取配置信息失败！");
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	private static void showConfig(){
		System.out.println("-----------------------配置信息-----------------");
		System.out.println("dirver: "+DB_DRIVER);
		System.out.println("url: "+DB_URL);
		System.out.println("user: "+DB_USER);
		System.out.println("passworld: "+DB_PWD);
		System.out.println("----------------------------------------------");
	}
	public static void main(String[] args) {
		DBConfig.showConfig();
	}

}
